package com.seata.demo.seatauser.controller;

import com.seata.demo.seatauser.entity.User;
import com.seata.demo.seatauser.feign.RoleFeign;
import com.seata.demo.seatauser.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class UserController {
    @Autowired
    UserService userService;

    @Autowired
    RoleFeign roleFeign;

    @PostMapping("/user/add")
    public void add(@RequestBody User user){
        userService.insert(user);
    }

    @PostMapping("/user/addUserRole")
    public void addUserRole(@RequestBody User user){
        userService.addUserRole(user);
    }

    @GetMapping("/user/test")
    public void test(){
        userService.test();
    }
}
